<?php
/**
 * Created by PhpStorm.
 * User: yellow
 * Date: 2019/5/22
 * Time: 12:18
 */

namespace app\admin\logic;


use app\admin\logic\code\ErrorCode;

class UploadLogic
{

    public function uploadImg($file, $name="common"){
        try{
            $info = $file->move( 'uploads/'.$name.'/');
            return ajaxArr(ErrorCode::$SUCCESS, 'success', ['img'=>'/uploads/'.$name.'/'.$info->getSaveName()]);
        } catch (\Exception $e){
            return ajaxArr(ErrorCode::$UPLOADERROR, $e->getMessage());
        }
    }

}